.TH "D:/FEUP/LCOM/WorkC/projecto/trunk/kbc.c" 3 "25 May 2010" "Colision" \" -*- nroff -*-
.ad l
.nh
.SH NAME
D:/FEUP/LCOM/WorkC/projecto/trunk/kbc.c \- 
.SH SYNOPSIS
.br
.PP
\fC#include 'kbc.h'\fP
.br

.SS "Functions"

.in +1c
.ti -1c
.RI "int \fBkbc_init\fP (int debug)"
.br
.ti -1c
.RI "void \fBmouse_disable\fP (void)"
.br
.ti -1c
.RI "int \fBwrite_kbc_cmd\fP (unsigned data)"
.br
.ti -1c
.RI "int \fBhas_DOS_mouse_ISR\fP ()"
.br
.ti -1c
.RI "int \fBwrite_kbc_data\fP (unsigned data)"
.br
.ti -1c
.RI "int \fBwrite_aux\fP (unsigned cmd)"
.br
.ti -1c
.RI "int \fBread_kbc\fP (void)"
.br
.ti -1c
.RI "int \fBwrite_kbc\fP (unsigned adr, unsigned data)"
.br
.ti -1c
.RI "void \fBblink_leds\fP (void)"
.br
.ti -1c
.RI "void \fBblink_led\fP (\fBuchar\fP led)"
.br
.ti -1c
.RI "void \fBinitKeyBoard\fP (void(*t0_handler)(void))"
.br
.ti -1c
.RI "void \fBendKeyBoard\fP ()"
.br
.ti -1c
.RI "void \fBhandler_keyboard\fP ()"
.br
.ti -1c
.RI "void \fBinitMouse\fP (void(*mouse_handler)(void))"
.br
.ti -1c
.RI "void \fBendMouse\fP ()"
.br
.in -1c
.SH "Function Documentation"
.PP 
.SS "int kbc_init (int debug)"Initializes the KeyBoard Controller. If 'debug' is not 0 every read or write to the KBC, together with the read or writed data is echoed to the screen. In this mode the function name being executed is printed followed by a ':', add=xx means the I/O address written, and data=xx the data read or written.
.PP
A 1 is returned if a mouse is found.
.PP
The function starts to flush any pending data in the KBC, reading the data register until a timeout is received.
.PP
Then it enables the KBC mouse interface, send a MouseReset to the mouse and checks for the correct answer (0xFA, 0xAA then 0x00). If the mouse was detected, data streaming is disabled (StreamDisable), SampleRate is set to 100, Resolution is set to 8 counts/mm, Scaling is set to 1:1, the mouse interrupts generation are enabled at the KBC (not at the PIC!), and data streaming enabled (StreamEnable). All this (but StreamEnable) shouldn't be necessary, as MouseReset is supposed to do it properly.
.PP
The KBDRate is also set to its maximum speed.
.PP
Uses \fBwrite_kbc_cmd()\fP, \fBwrite_kbc_data()\fP, \fBread_kbc()\fP and \fBwrite_aux()\fP
.PP
Example Output generated with debug = 1: \fC
.PP
.nf

read_kbc: timeout
write_kbc: add=64 data=d4
write_kbc: add=60 data=ff
read_kbc: data=fa
read_kbc: data=aa
read_kbc: data= 0
write_kbc: add=60 data=f5
read_kbc: data=fa
write_kbc: add=64 data=a7
write_kbc: add=64 data=d4
write_kbc: add=60 data=f5
read_kbc: data=fa
write_kbc: add=60 data=f3
read_kbc: data=fa
write_kbc: add=60 data= 0
read_kbc: data=fa
write_kbc: add=64 data=d4
write_kbc: add=60 data=f3
read_kbc: data=fa
write_kbc: add=64 data=d4
write_kbc: add=60 data= a
read_kbc: data=fa
write_kbc: add=64 data=d4
write_kbc: add=60 data=e8
read_kbc: data=fa
write_kbc: add=64 data=d4
write_kbc: add=60 data= 1
read_kbc: data=fa
write_kbc: add=64 data=20
read_kbc: data=45
write_kbc: add=64 data=60
write_kbc: add=60 data=47
read_kbc: timeout
write_kbc: add=60 data=f4
read_kbc: data=fa
write_kbc: add=64 data=a8
write_kbc: add=64 data=d4
write_kbc: add=60 data=f4
read_kbc: data=fa
 
.fi
.PP
\fP 
.SH "Author"
.PP 
Generated automatically by Doxygen for Colision from the source code.
